package com.xy.condition;


import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Objects;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/4/7 15:16
 * @description 判断是否 windows 系统
 */


public class WindowsConditional implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String osName = context.getEnvironment().getProperty("os.name");
        return osName !=null && osName.contains("Windows");
    }
}
